package com.ft.turorial.spring.boot.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ft.turorial.spring.boot.domain.User;
import com.ft.turorial.spring.boot.mapper.UserMapper;

@Service
public class UserServiceImpl implements UserService {

	@Autowired
    private UserMapper userMapper;
	@Override
	public User save(User user) {
		return userMapper.insert(user);
	}
	@Override
	public User saveSelective(User user) {
		return userMapper.insertSelective(user);
	}
	@Override
	public User findOne(int id) {
		return userMapper.findOne(id);
	}
	@Override
	public List<User> findAll() {
		return userMapper.findAll();
	}
	@Override
	public User findLikeName(String name) {
		return userMapper.findLikeName(name);
	}
	@Override
	public int delete(int id) {
		return userMapper.deleteByPrimaryKey(id);
	}
	@Override
	public int update(User user) {
		return userMapper.updateByPrimaryKey(user);
	}
	@Override
	public int updateSelective(User user) {
		return userMapper.updateByPrimaryKeySelective(user);
	}

}
